﻿#pragma once

#include "../../Server/MirEnvir/Envir.h"
#include "../../Server/MirDatabase/ConquestInfo.h"
#include <vector>
#include <any>

using namespace Server::MirDatabase;
using namespace Server::MirEnvir;

namespace Server
{
    class ConquestInfoForm : public System::Windows::Forms::Form
    {
    public:
        virtual ~ConquestInfoForm()
        {
            delete selectedConquest;
            delete selectedArcher;
            delete selectedGate;
            delete selectedWall;
            delete selectedSiege;
            delete selectedFlag;
            delete selectedControlPoint;
            delete components;
            delete ConquestInfoListBox;
            delete Main_tabs;
            delete Info_tab;
            delete label1;
            delete Name_textbox;
            delete Index_textbox;
            delete label2;
            delete Guards_tab;
            delete Guards_listbox;
            delete AddConq_button;
            delete AddGuard_button;
            delete label9;
            delete label10;
            delete ArchXLoc_textbox;
            delete ArchYLoc_textbox;
            delete Maps_tab;
            delete AddExtraMap_button;
            delete label12;
            delete ExtraMaps_combo;
            delete label7;
            delete ConquestMap_combo;
            delete Maps_listbox;
            delete RemoveConq_button;
            delete Archer_gb;
            delete label11;
            delete ArcherIndex_combo;
            delete label14;
            delete ArcherName_textbox;
            delete label13;
            delete Gates_tab;
            delete AddGate_button;
            delete Gates_gb;
            delete label16;
            delete label17;
            delete GateIndex_combo;
            delete label18;
            delete GateYLoc_textbox;
            delete label19;
            delete GateXLoc_textbox;
            delete Gates_listbox;
            delete Walls_tab;
            delete AddWall_button;
            delete Walls_gb;
            delete label15;
            delete label20;
            delete WallIndex_combo;
            delete label21;
            delete WallYLoc_textbox;
            delete label22;
            delete WallXLoc_textbox;
            delete Walls_listbox;
            delete label23;
            delete ArcherCost_textbox;
            delete label24;
            delete GateCost_textbox;
            delete label25;
            delete GateName_textbox;
            delete label26;
            delete WallCost_textbox;
            delete label27;
            delete WallName_textbox;
            delete label33;
            delete WarType_combo;
            delete label34;
            delete WarMode_combo;
            delete Times_tab;
            delete WarTimes_gb;
            delete Sat_checkbox;
            delete Sun_checkbox;
            delete Fri_checkbox;
            delete Thu_checkbox;
            delete Tue_checkbox;
            delete Wed_checkbox;
            delete Mon_checkbox;
            delete StartHour_num;
            delete WarLength_num;
            delete label31;
            delete label32;
            delete label35;
            delete RemoveMap_button;
            delete label6;
            delete Size_textbox;
            delete label5;
            delete label4;
            delete label3;
            delete LocX_textbox;
            delete LocY_textbox;
            delete RemoveGuard_button;
            delete RemoveGate_button;
            delete RemoveWall_button;
            delete Siege_tab;
            delete RemoveSiege_button;
            delete AddSiege_button;
            delete Siege_gb;
            delete label36;
            delete SiegeCost_textbox;
            delete label37;
            delete SiegeName_textbox;
            delete label38;
            delete label39;
            delete SiegeIndex_combo;
            delete label40;
            delete SiegeYLoc_textbox;
            delete label41;
            delete SiegeXLoc_textbox;
            delete Siege_listbox;
            delete flags_tab;
            delete RemoveFlag_button;
            delete AddFlag_button;
            delete Flag_gb;
            delete label43;
            delete FlagName_textbox;
            delete label45;
            delete label46;
            delete FlagYLoc_textbox;
            delete label47;
            delete FlagXLoc_textbox;
            delete Flags_listbox;
            delete label42;
            delete FlagFilename_textbox;
            delete games_tab;
            delete GameTabs;
            delete palace_tab;
            delete king_tab;
            delete Objective_gb;
            delete label28;
            delete ObSize_textbox;
            delete label29;
            delete label30;
            delete ObLocX_textbox;
            delete ObLocY_textbox;
            delete control_tab;
            delete label8;
            delete PalaceMap_combo;
            delete FullMap_checkbox;
            delete RemoveControl_button;
            delete AddControl_button;
            delete Control_gb;
            delete label44;
            delete ControlFilename_textbox;
            delete label48;
            delete ControlName_textbox;
            delete label49;
            delete label50;
            delete ControlYLoc_textbox;
            delete label51;
            delete ControlXLoc_textbox;
            delete Controls_listbox;
        }

        Server::MirEnvir::Envir *getEnvir() const;

    private:
        ConquestInfo *selectedConquest;
        ConquestArcherInfo *selectedArcher;
        ConquestGateInfo *selectedGate;
        ConquestWallInfo *selectedWall;
        ConquestSiegeInfo *selectedSiege;
        ConquestFlagInfo *selectedFlag;
        ConquestFlagInfo *selectedControlPoint;

    public:
        ConquestInfoForm();



    private:
        void ConquestInfoForm_Load(std::any sender, EventArgs *e);


        void UpdateArchers();

        void UpdateFlags();

        void UpdateGates();

        void UpdateWalls();

        void UpdateSiege();

        void UpdateControlPoints();

        void UpdateInterface();

        void ConquestInfoListBox_SelectedIndexChanged(std::any sender, EventArgs *e);

        void AddConq_button_Click(std::any sender, EventArgs *e);

        void AddGuard_button_Click(std::any sender, EventArgs *e);

        void Guards_listbox_SelectedIndexChanged(std::any sender, EventArgs *e);

        void AddExtraMap_button_Click(std::any sender, EventArgs *e);

        void ConquestInfoForm_FormClosed(std::any sender, FormClosedEventArgs *e);

        void Name_textbox_TextChanged(std::any sender, EventArgs *e);

        void LocX_textbox_TextChanged(std::any sender, EventArgs *e);

        void LocY_textbox_TextChanged(std::any sender, EventArgs *e);

        void Size_textbox_TextChanged(std::any sender, EventArgs *e);

        void ArchXLoc_textbox_TextChanged(std::any sender, EventArgs *e);

        void ArchYLoc_textbox_TextChanged(std::any sender, EventArgs *e);

        void ConquestMap_combo_SelectedIndexChanged(std::any sender, EventArgs *e);

        void PalaceMap_combo_SelectedIndexChanged(std::any sender, EventArgs *e);

        void ArcherIndex_combo_SelectedIndexChanged(std::any sender, EventArgs *e);

        void ArcherName_textbox_TextChanged(std::any sender, EventArgs *e);

        void AddGate_button_Click(std::any sender, EventArgs *e);

        void Gates_listbox_SelectedIndexChanged(std::any sender, EventArgs *e);

        void GateXLoc_textbox_TextChanged(std::any sender, EventArgs *e);

        void GateIndex_combo_SelectedIndexChanged(std::any sender, EventArgs *e);

        void GateYLoc_textbox_TextChanged(std::any sender, EventArgs *e);

        void AddWall_button_Click(std::any sender, EventArgs *e);

        void Walls_listbox_SelectedIndexChanged(std::any sender, EventArgs *e);

        void WallIndex_combo_SelectedIndexChanged(std::any sender, EventArgs *e);

        void WallXLoc_textbox_TextChanged(std::any sender, EventArgs *e);

        void WallYLoc_textbox_TextChanged(std::any sender, EventArgs *e);

        void ArcherCost_textbox_TextChanged(std::any sender, EventArgs *e);

        void GateCost_textbox_TextChanged(std::any sender, EventArgs *e);

        void WallCost_textbox_TextChanged(std::any sender, EventArgs *e);

        void GateName_textbox_TextChanged(std::any sender, EventArgs *e);

        void Walls_gb_Enter(std::any sender, EventArgs *e);

        void WallName_textbox_TextChanged(std::any sender, EventArgs *e);


        void WarType_combo_SelectedIndexChanged(std::any sender, EventArgs *e);

        void WarMode_combo_SelectedIndexChanged(std::any sender, EventArgs *e);

        void WarTimes_gb_Enter(std::any sender, EventArgs *e);

        void StartHour_num_ValueChanged(std::any sender, EventArgs *e);

        void WarLength_num_ValueChanged(std::any sender, EventArgs *e);

        void Mon_checkbox_CheckedChanged(std::any sender, EventArgs *e);

        void Tue_checkbox_CheckedChanged(std::any sender, EventArgs *e);

        void Wed_checkbox_CheckedChanged(std::any sender, EventArgs *e);

        void Thu_checkbox_CheckedChanged(std::any sender, EventArgs *e);

        void Fri_checkbox_CheckedChanged(std::any sender, EventArgs *e);

        void Sat_checkbox_CheckedChanged(std::any sender, EventArgs *e);

        void Sun_checkbox_CheckedChanged(std::any sender, EventArgs *e);

        void RemoveConq_button_Click(std::any sender, EventArgs *e);

        void RemoveMap_button_Click(std::any sender, EventArgs *e);

        void Maps_listbox_SelectedIndexChanged(std::any sender, EventArgs *e);

        void RemoveGuard_button_Click(std::any sender, EventArgs *e);

        void RemoveGate_button_Click(std::any sender, EventArgs *e);

        void RemoveWall_button_Click(std::any sender, EventArgs *e);

        void ObLocX_textbox_TextChanged(std::any sender, EventArgs *e);

        void ObLocY_textbox_TextChanged(std::any sender, EventArgs *e);

        void ObSize_textbox_TextChanged(std::any sender, EventArgs *e);

        void Siege_listbox_SelectedIndexChanged(std::any sender, EventArgs *e);

        void AddSiege_button_Click(std::any sender, EventArgs *e);

        void RemoveSiege_button_Click(std::any sender, EventArgs *e);

        void SiegeXLoc_textbox_TextChanged(std::any sender, EventArgs *e);

        void SiegeYLoc_textbox_TextChanged(std::any sender, EventArgs *e);

        void SiegeName_textbox_TextChanged(std::any sender, EventArgs *e);

        void SiegeCost_textbox_TextChanged(std::any sender, EventArgs *e);

        void SiegeIndex_combo_SelectedIndexChanged(std::any sender, EventArgs *e);

        void RemoveFlag_button_Click(std::any sender, EventArgs *e);

        void AddFlag_button_Click(std::any sender, EventArgs *e);

        void FlagXLoc_textbox_TextChanged(std::any sender, EventArgs *e);

        void FlagYLoc_textbox_TextChanged(std::any sender, EventArgs *e);

        void FlagName_textbox_TextChanged(std::any sender, EventArgs *e);

        void Flags_listbox_SelectedIndexChanged(std::any sender, EventArgs *e);

        void FlagFilename_textbox_TextChanged(std::any sender, EventArgs *e);

        void FullMap_checkbox_CheckedChanged(std::any sender, EventArgs *e);



        void Control_Listbox_SelectedIndexChanged(std::any sender, EventArgs *e);

        void AddControl_button_Click(std::any sender, EventArgs *e);

        void RemoveControl_button_Click(std::any sender, EventArgs *e);

        void ControlXLoc_textbox_TextChanged(std::any sender, EventArgs *e);

        void ControlYLoc_textbox_TextChanged(std::any sender, EventArgs *e);

        void ControlName_textbox_TextChanged(std::any sender, EventArgs *e);

        void ControlFilename_textbox_TextChanged(std::any sender, EventArgs *e);


        /// <summary>
        /// Required designer variable.
        /// </summary>
        System::ComponentModel::IContainer *components = nullptr;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    protected:
        void Dispose(bool disposing) override;

        #pragma region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
    private:
        void InitializeComponent();

        #pragma endregion

        System::Windows::Forms::ListBox *ConquestInfoListBox;
        System::Windows::Forms::TabControl *Main_tabs;
        System::Windows::Forms::TabPage *Info_tab;
        System::Windows::Forms::Label *label1;
        System::Windows::Forms::TextBox *Name_textbox;
        System::Windows::Forms::TextBox *Index_textbox;
        System::Windows::Forms::Label *label2;
        System::Windows::Forms::TabPage *Guards_tab;
        System::Windows::Forms::ListBox *Guards_listbox;
        System::Windows::Forms::Button *AddConq_button;
        System::Windows::Forms::Button *AddGuard_button;
        System::Windows::Forms::Label *label9;
        System::Windows::Forms::Label *label10;
        System::Windows::Forms::TextBox *ArchXLoc_textbox;
        System::Windows::Forms::TextBox *ArchYLoc_textbox;
        System::Windows::Forms::TabPage *Maps_tab;
        System::Windows::Forms::Button *AddExtraMap_button;
        System::Windows::Forms::Label *label12;
        System::Windows::Forms::ComboBox *ExtraMaps_combo;
        System::Windows::Forms::Label *label7;
        System::Windows::Forms::ComboBox *ConquestMap_combo;
        System::Windows::Forms::ListBox *Maps_listbox;
        System::Windows::Forms::Button *RemoveConq_button;
        System::Windows::Forms::GroupBox *Archer_gb;
        System::Windows::Forms::Label *label11;
        System::Windows::Forms::ComboBox *ArcherIndex_combo;
        System::Windows::Forms::Label *label14;
        System::Windows::Forms::TextBox *ArcherName_textbox;
        System::Windows::Forms::Label *label13;
        System::Windows::Forms::TabPage *Gates_tab;
        System::Windows::Forms::Button *AddGate_button;
        System::Windows::Forms::GroupBox *Gates_gb;
        System::Windows::Forms::Label *label16;
        System::Windows::Forms::Label *label17;
        System::Windows::Forms::ComboBox *GateIndex_combo;
        System::Windows::Forms::Label *label18;
        System::Windows::Forms::TextBox *GateYLoc_textbox;
        System::Windows::Forms::Label *label19;
        System::Windows::Forms::TextBox *GateXLoc_textbox;
        System::Windows::Forms::ListBox *Gates_listbox;
        System::Windows::Forms::TabPage *Walls_tab;
        System::Windows::Forms::Button *AddWall_button;
        System::Windows::Forms::GroupBox *Walls_gb;
        System::Windows::Forms::Label *label15;
        System::Windows::Forms::Label *label20;
        System::Windows::Forms::ComboBox *WallIndex_combo;
        System::Windows::Forms::Label *label21;
        System::Windows::Forms::TextBox *WallYLoc_textbox;
        System::Windows::Forms::Label *label22;
        System::Windows::Forms::TextBox *WallXLoc_textbox;
        System::Windows::Forms::ListBox *Walls_listbox;
        System::Windows::Forms::Label *label23;
        System::Windows::Forms::TextBox *ArcherCost_textbox;
        System::Windows::Forms::Label *label24;
        System::Windows::Forms::TextBox *GateCost_textbox;
        System::Windows::Forms::Label *label25;
        System::Windows::Forms::TextBox *GateName_textbox;
        System::Windows::Forms::Label *label26;
        System::Windows::Forms::TextBox *WallCost_textbox;
        System::Windows::Forms::Label *label27;
        System::Windows::Forms::TextBox *WallName_textbox;
        System::Windows::Forms::Label *label33;
        System::Windows::Forms::ComboBox *WarType_combo;
        System::Windows::Forms::Label *label34;
        System::Windows::Forms::ComboBox *WarMode_combo;
        System::Windows::Forms::TabPage *Times_tab;
        System::Windows::Forms::GroupBox *WarTimes_gb;
        System::Windows::Forms::CheckBox *Sat_checkbox;
        System::Windows::Forms::CheckBox *Sun_checkbox;
        System::Windows::Forms::CheckBox *Fri_checkbox;
        System::Windows::Forms::CheckBox *Thu_checkbox;
        System::Windows::Forms::CheckBox *Tue_checkbox;
        System::Windows::Forms::CheckBox *Wed_checkbox;
        System::Windows::Forms::CheckBox *Mon_checkbox;
        System::Windows::Forms::NumericUpDown *StartHour_num;
        System::Windows::Forms::NumericUpDown *WarLength_num;
        System::Windows::Forms::Label *label31;
        System::Windows::Forms::Label *label32;
        System::Windows::Forms::Label *label35;
        System::Windows::Forms::Button *RemoveMap_button;
        System::Windows::Forms::Label *label6;
        System::Windows::Forms::TextBox *Size_textbox;
        System::Windows::Forms::Label *label5;
        System::Windows::Forms::Label *label4;
        System::Windows::Forms::Label *label3;
        System::Windows::Forms::TextBox *LocX_textbox;
        System::Windows::Forms::TextBox *LocY_textbox;
        System::Windows::Forms::Button *RemoveGuard_button;
        System::Windows::Forms::Button *RemoveGate_button;
        System::Windows::Forms::Button *RemoveWall_button;
        System::Windows::Forms::TabPage *Siege_tab;
        System::Windows::Forms::Button *RemoveSiege_button;
        System::Windows::Forms::Button *AddSiege_button;
        System::Windows::Forms::GroupBox *Siege_gb;
        System::Windows::Forms::Label *label36;
        System::Windows::Forms::TextBox *SiegeCost_textbox;
        System::Windows::Forms::Label *label37;
        System::Windows::Forms::TextBox *SiegeName_textbox;
        System::Windows::Forms::Label *label38;
        System::Windows::Forms::Label *label39;
        System::Windows::Forms::ComboBox *SiegeIndex_combo;
        System::Windows::Forms::Label *label40;
        System::Windows::Forms::TextBox *SiegeYLoc_textbox;
        System::Windows::Forms::Label *label41;
        System::Windows::Forms::TextBox *SiegeXLoc_textbox;
        System::Windows::Forms::ListBox *Siege_listbox;
        System::Windows::Forms::TabPage *flags_tab;
        System::Windows::Forms::Button *RemoveFlag_button;
        System::Windows::Forms::Button *AddFlag_button;
        System::Windows::Forms::GroupBox *Flag_gb;
        System::Windows::Forms::Label *label43;
        System::Windows::Forms::TextBox *FlagName_textbox;
        System::Windows::Forms::Label *label45;
        System::Windows::Forms::Label *label46;
        System::Windows::Forms::TextBox *FlagYLoc_textbox;
        System::Windows::Forms::Label *label47;
        System::Windows::Forms::TextBox *FlagXLoc_textbox;
        System::Windows::Forms::ListBox *Flags_listbox;
        System::Windows::Forms::Label *label42;
        System::Windows::Forms::TextBox *FlagFilename_textbox;
        System::Windows::Forms::TabPage *games_tab;
        System::Windows::Forms::TabControl *GameTabs;
        System::Windows::Forms::TabPage *palace_tab;
        System::Windows::Forms::TabPage *king_tab;
        System::Windows::Forms::GroupBox *Objective_gb;
        System::Windows::Forms::Label *label28;
        System::Windows::Forms::TextBox *ObSize_textbox;
        System::Windows::Forms::Label *label29;
        System::Windows::Forms::Label *label30;
        System::Windows::Forms::TextBox *ObLocX_textbox;
        System::Windows::Forms::TextBox *ObLocY_textbox;
        System::Windows::Forms::TabPage *control_tab;
        System::Windows::Forms::Label *label8;
        System::Windows::Forms::ComboBox *PalaceMap_combo;
        System::Windows::Forms::CheckBox *FullMap_checkbox;
        System::Windows::Forms::Button *RemoveControl_button;
        System::Windows::Forms::Button *AddControl_button;
        System::Windows::Forms::GroupBox *Control_gb;
        System::Windows::Forms::Label *label44;
        System::Windows::Forms::TextBox *ControlFilename_textbox;
        System::Windows::Forms::Label *label48;
        System::Windows::Forms::TextBox *ControlName_textbox;
        System::Windows::Forms::Label *label49;
        System::Windows::Forms::Label *label50;
        System::Windows::Forms::TextBox *ControlYLoc_textbox;
        System::Windows::Forms::Label *label51;
        System::Windows::Forms::TextBox *ControlXLoc_textbox;
        System::Windows::Forms::ListBox *Controls_listbox;
    };
}
